<template>
  <common-edit-dialog
    :title="dialogTitle"
    :visible.sync="dialogShow"
    :button-loading="buttonLoading"
    @cancel="close"
    @submit="submitForm"
  >
    <el-form ref="form" :model="form" label-width="80px" @submit.native.prevent>
      <el-row :gutter="18">
        <el-col :span="24">
          <el-form-item label="所属组织" prop="deptId">
             <el-cascader
              ref="myCascader"
              v-model="form.deptId"
              :options="deptSelectArr"
              :props="{ checkStrictly: true,emitPath:false }"
            ></el-cascader>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </common-edit-dialog>
</template>

<script>
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";

export default {
  name: "distributeOrg",
  components: { Treeselect },
  props: {
    deptSelectArr: {
      type: Array,
      default: () => [],
    },
    dialogShow: {
      type: Boolean,
      default: false
    },
    buttonLoading: {
      type: Boolean,
      default: false
    },
  },
  data() {
    return {
      dialogTitle: "分配组织",
      form: {
        deptId: undefined,
      },
    };
  },
  computed: {},
  methods: {
    show() {
      this.form.deptId = undefined;
    },
    submitForm() {
      this.$emit("toSubmit", this.form.deptId);
    },
    close() {
      this.$emit("close");
    },
  },
  created() {},
};
</script>
<style lang="scss" scoped>
.el-cascader {
  width: 100%;
}
</style>
